package com.byl.modules.wx.gzh.controller;

import com.byl.common.modules.controller.BaseController;
import com.byl.modules.wx.gzh.service.AccessTokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Created by Administrator on 2019/9/19.
 */
@RestController
@RequestMapping("/api/wx/gzh")
public class AccessTokenController extends BaseController {

    @Autowired
    AccessTokenService accessTokenService;

    @GetMapping("/token")
    public String token(){
        Map rs=accessTokenService.token();
        if(rs.containsKey("errcode")){
            return fail(rs.get("errmsg").toString());
        }
        return success("获取access token ",rs);
    }
}
